//
//  ViewController.m
//  JingJing
//
//  Created by Maxwell Rose on 15/10/10.
//  Copyright © 2015年 JingJing. All rights reserved.
//

#import "ViewController.h"
#import "WelcomeViewController.h"
#import "TotalViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
    NSString *versionNum =[infoDict objectForKey:@"CFBundleShortVersionString"];
    if([[NSUserDefaults standardUserDefaults]objectForKey:@"FirstLanding"])
    {
        if([[[NSUserDefaults standardUserDefaults]objectForKey:@"FirstLanding"] isEqualToString:versionNum])
        {
            [[UIApplication sharedApplication]setStatusBarHidden:FALSE];
            [[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleLightContent];
            TotalViewController *totalViewCon = [[TotalViewController alloc]init];
            [self.navigationController pushViewController:totalViewCon animated:FALSE];
        }
        else
        {
            [[NSUserDefaults standardUserDefaults]setObject:versionNum forKey:@"FirstLanding"];
            WelcomeViewController *welcomeViewCon = [[WelcomeViewController alloc]init];
            [self.navigationController pushViewController:welcomeViewCon animated:FALSE];
        }
    }
    else
    {
        [[NSUserDefaults standardUserDefaults]setObject:versionNum forKey:@"FirstLanding"];
        WelcomeViewController *welcomeViewCon = [[WelcomeViewController alloc]init];
        [self.navigationController pushViewController:welcomeViewCon animated:FALSE];
    }
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
